import http from 'axios';
import { Message } from 'element-ui';

// http.defaults.withCredentials = true;
http.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8';

http.interceptors.response.use( 
 response => {  
    // console.log('http1',response)
   
  if (response.status == 200) {   
    // console.log('http',response)
   return Promise.resolve(response);  
  } else {   
   console.log('http',response)
   return Promise.reject('error',response);  
  } 
 },
 // 服务器状态码不是200的情况 
 error => {  
   console.log('http',error)
   return Promise.reject('err',error);   
 }
);

export default http;